package com.csi.service;

import com.csi.mapper.TravelPackageMapper;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class TravelPackageService {

    @Autowired
    private TravelPackageMapper travelPackageMapper;

    @RabbitListener(queues = "travelPackage.queue")
    public void travelPackage(Map<String,Object> map) {
        Long id = (Long) map.get("id");
        Integer num = (Integer) map.get("num");
        System.out.println("map = " + map);
        travelPackageMapper.sub(id,num);
    }
}
